<div class='top' onmousedown='sortable()' title='可以用鼠标拖拽来随意摆放哦'>
  <div class='title'>
    <%= link_to_tool_by_setting @setting %>
  </div>
  <div class='supports'>
    
  </div>
  <div class='tools'>
    <span id="portalet_<%= @setting.id %>_arrows" style='display:none;'>
      <%= link_to "←", "index", :class => :arrow %>
      <%= link_to "↑", "index", :class => :arrow %>
      <%= link_to "↓", "index", :class => :arrow %>
      <%= link_to "→", "index", :class => :arrow %>
    </span>
    <span class='h'>
      <%= link_to_remote "克隆", 
            :update => "' + $('portalet_#{@setting.id}').parentNode.id + '" ,
            :url => copy_tools_number_location_url(@setting),
            :method => :post,
            :html => {
              :class => :h 
            }            
        %>
        
      <%= link_to_remote "移除", 
            :confirm => '确认要扔掉这片吐司吗？',
            :url => tools_number_location_url(@setting),
            :method => :delete,
            :loading => "Effect.Fade('portalet_#{@setting.id}')",
            :html => {
              :class => :h 
            }            
        %>
    </span>
  </div>
</div>
<div id='tool_<%= @setting.id %>_content' class='content'>
  <div class='number_location'>
    <div class='line'>
      <% remote_form_for :number_location,
          @location.try(:number),
          :update => "portalet_#{@setting.id}",
          :url => tools_number_locations_url(:setting_id => @setting.id),
          :method => :get,
          :loading => "$('search_location_#{@setting.id}').innerHTML = '查询中...'",
          :complete => "$('search_location_#{@setting.id}').innerHTML = '查询'",
          :html => {
            :id => "number_location_form_#{@setting.id}"
          } do |f| %>
      <%= text_field_tag "number",
           @location.try(:number),
           :id => "number_#{@setting.id}",
           :title => '请输入手机号、身份证号、IP中的一种'
      %><%= link_to_function "查询", "$('number_location_form_#{@setting.id}').onsubmit()", :class => 'search', :id => "search_location_#{@setting.id}" %>
      <% end %>
    </div>
    <div class='line'>
      <% if @location.present? %>
        <% if @location.mobile? %>
          <div class='line'>
            <div class='result'>
              <table cellspacing="1" cellpadding="1">
                <tr>
                  <th>归属地</th>
                  <td><%= @location.location %></td>
                </tr>
              </table>
            </div>
          </div>
        <% elsif @location.ip? %>
      <div class='result'>
          <table cellspacing="1" cellpadding="1">
            <tr>
              <th>归属地</th>
              <td><%= @location.location %></td>
            </tr>
          </table>
        </div>
        <% elsif @location.id? %>
        <div class='line'>
            <div class='result'>
              <table cellspacing="1" cellpadding="1">
                <tr>
                  <th>性别</th>
                  <td><%= t @location.sex %></td>
                </tr>
                <tr>
                  <th>生日</th>
                  <td><%= @location.birthday %></td>
                </tr>
                <tr>
                  <th>归属地</th>
                  <td><%= @location.location %></td>
                </tr>
              </table>
            </div>
          </div>
        <% else %>
        <div class='result'>
          搜索不到，是不是您输错了？
        </div>
        <% end %>
      <% else %>
      <div class='result'>
        请输入手机号、身份证号、IP中的一种
      </div>
      <% end %>
    </div>    
  </div>  
</div>

  